Skip to content

Conversation

@idan-starkware
Copy link

Fixes #503

  • Add nil check for CreatedAt/UpdatedAt timestamps to prevent panics
  • Add 'None' option to Time Field dropdown (default) to return all workflows
  • Improve time filtering logic with better nil handling
  • Add debug logging for troubleshooting

Testing

  • ✅ All existing tests pass
  • ✅ Tested locally with docker-compose
  • ✅ Verified workflows are returned when Time Field is "None"
  • ✅ Verified time filtering works with CreatedAt/UpdatedAt options

Fixes grafana#503

- Add nil check for CreatedAt/UpdatedAt timestamps to prevent panics
- Add 'None' option to Time Field dropdown (default) to return all workflows
- Improve time filtering logic with better nil handling
- Add debug logging for troubleshooting
@idan-starkware idan-starkware requested a review from a team as a code owner November 4, 2025 15:24
@CLAassistant
Copy link

CLAassistant commented Nov 4, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Member

@zoltanbedi zoltanbedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this PR @idan-starkware. I tried it out and it worked as expected. Please create a changeset for this and also update the docs in docs/sources/query/_index.md.

{
"name": "grafana-github-datasource",
"version": "2.3.0",
"version": "2.3.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this? We will release a new version with this change in a separate pr.


// If time field is None, return all workflows without filtering
if opts.TimeField == models.WorkflowTimeFieldNone {
backend.Logger.Debug("GetWorkflows", "time_field_none", "returning_all_workflows")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can figure it out from the debug log above that the time field is none.

Suggested change
backend.Logger.Debug("GetWorkflows", "time_field_none", "returning_all_workflows")

shouldInclude = !createdAtTime.Before(timeRange.From) && !createdAtTime.After(timeRange.To)
if !shouldInclude {
excludedCount++
backend.Logger.Debug("keepWorkflowsInTimeRange", "workflow_excluded", *workflow.Name, "createdAt", createdAtTime, "timeRange", fmt.Sprintf("%v to %v", timeRange.From, timeRange.To))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this debug log. The summary debug log is enough.

shouldInclude = !updatedAtTime.Before(timeRange.From) && !updatedAtTime.After(timeRange.To)
if !shouldInclude {
excludedCount++
backend.Logger.Debug("keepWorkflowsInTimeRange", "workflow_excluded", *workflow.Name, "updatedAt", updatedAtTime, "timeRange", fmt.Sprintf("%v to %v", timeRange.From, timeRange.To))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this debug log. The summary debug log is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Empty result on Workflows query type

3 participants